package reflect;
/**
 * JDK5之后Java提供了一个特性:变长参数
 */
public class ArgsDemo {
    public static void main(String[] args) {
        //变长参数只能是方法的最后一个参数!!!
        //变长参数是编译器认可的，最终编译后会被改为数组
        doSome(10,new String[]{"hello"});
        doSome(10,new String[]{"hello","one"});
        doSome(10,new String[]{"hello","one","one"});
        doSome(10,new String[]{"hello","one","one","one"});
        doSome(10,new String[]{"hello","one","one","one","one"});
        doSome(10,new String[]{"hello","one","one","one","one","one"});
        /*
        doSome(10,"hello");
        doSome(10,"hello","one");
        doSome(10,"hello","one","one");
        doSome(10,"hello","one","one","one");
        doSome(10,"hello","one","one","one","one");
        doSome(10,"hello","one","one","one","one","one");
         */
    }
    public static void doSome(int a,String[] s){
    //public static void doSome(int a,String... s){
        System.out.println(s.length);
    }
}
